package com.zhongfl.crm.enums.boss;

import lombok.Getter;

/**
 * @author 木叶丸
 * @date 2018/8/24 13:59
 */
@Getter
public enum ReasonType {

    /**
     * 非一次性通过原因
     */
    CUSTOMER_REASONS(1,"客户原因"),
    DELIVER_REASONS(2,"交付原因"),
    BANK_REASONS(3,"银行原因"),

    OTHER(0,"其他");

    private Integer key;

    private String value;

    ReasonType(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static ReasonType getEnumByKey(Integer key) {
        for (ReasonType item : ReasonType.values()) {
            if (item.getKey().equals(key)) {
                return item;
            }
        }
        return OTHER;
    }

    public static ReasonType getEnumByName(String value) {
        for (ReasonType item : ReasonType.values()) {
            if (item.name().equals(value)) {
                return item;
            }
        }
        return OTHER;
    }
}
